<?php


class LoginController extends BaseController {

	public $rules = array();
	
	public function __construct(){ }
	
	public function index(){
		return View::make('login.create');
	}
	
	public function store() {
		 
		 $tradeName = Input::get('trade_name');
         $password  = Input::get('password');
         
         if(Auth::attempt(['trade_name' => $tradeName, 'password' => $password])){
         	 Session::put('uname', $tradeName);
			 return Redirect::to('profile');
		 } else {
			 return 'auth failed';
         }
	}
	
	public function getUserProfile(){
		return View::make('traders.profile.profile')->with('uname', Session::get('uname'));
	}


}